***REPLICATION CODE FOR PUBLIC POLICY AND ELECTIONS IN AUTHORITARIAN REGIMES***


***Generating the post treatment variable (for presidential election data)

gen post=0
replace post = 1 if year==2018


***Generating the post_16 treatment variable (for parliamentary election data)

gen post16=0
replace post16 = 1 if year==2016


***FIXED EFFECTS MODELS

xtset rayonid year

***TABLE 1

***Putin's/Medvedev's vote share as the DV

eststo: xtreg c.putin post##c.percenttitmin, fe vce(robust)

***KPRF vote share as the DV

eststo: xtreg c.kprf post##c.percenttitmin, fe vce(robust)

***Turnout as the DV

eststo: xtreg c.turnout post##c.percenttitmin, fe vce(robust)

esttab using [filename].rtf, se(3) b(3) r2 label


***TABLE 2

***Putin's/Medvedev's vote share as the DV

eststo: xtreg c.putin post##c.percenttitmin if ethnicregion==1, fe vce(robust)

***KPRF vote share as the DV

eststo: xtreg c.kprf post##c.percenttitmin if ethnicregion==1, fe vce(robust)

***Electoral turnout as the DV

eststo: xtreg c.turnout post##c.percenttitmin if ethnicregion==1, fe vce(robust)


***Just rayons located in Tatarstan

eststo: xtreg c.putin post##c.percenttitmin if regionid==16, fe vce(robust)

esttab using [filename].rtf, se(3) b(3) r2 label


***TABLE 3

eststo: xtreg c.ur post16##c.percenttitmin, fe vce(robust)

esttab using [filename].rtf, se(3) b(3) r2 label



***FIGURE 1 AND 2

******FIGURE 1 Pro-Regime Presidential Candidates' Vote Share***

egen median_putin = median(putin), by(year majtitminrayon)
egen tag_median_putin = tag(year majtitminrayon)
keep if tag_median_putin == 1


twoway (line median_putin year if majtitminrayon == 1, lcolor(red)) ///
       (line median_putin year if majtitminrayon == 0, lcolor(gray) lpattern(dash)), ///
       title("Trends in Putin's Vote") ytitle("Putin's Vote") xtitle("Time") ///
       legend(label(1 "Majority Titular Rayons") label(2 "Majority Other Rayons"))
	   
	   
***FIGURE 1 Voter Turnout***

egen median_turnout = median(turnout), by(year majtitminrayon)
egen tag_median_turnout = tag(year majtitminrayon)
keep if tag_median_turnout == 1


twoway (line median_turnout year if majtitminrayon == 1, lcolor(red)) ///
       (line median_turnout year if majtitminrayon == 0, lcolor(gray) lpattern(dash)), ///
       title("Trends in Turnout") ytitle("Turnout") xtitle("Time") ///
       legend(label(1 "Majority Titular Rayons") label(2 "Majority Other Rayons"))
	   
***FIGURE 2 UR Vote Share*** 

egen median_ur = median(ur), by(year majtitminrayon)
egen tag_median_ur = tag(year majtitminrayon)
keep if tag_median_ur == 1


twoway (line median_ur year if majtitminrayon == 1, lcolor(red)) ///
       (line median_ur year if majtitminrayon == 0, lcolor(gray) lpattern(dash)), ///
       title("Trends in UR vote share") ytitle("UR vote share") xtitle("Time") ///
       legend(label(1 "Majority Titular Rayons") label(2 "Majority Other Rayons"))  